<?php 

require 'dbconnect.php';
$query = "SELECT * FROM students;";
$result = mysql_query($query);
/*
$json = '[';
$first = true;
while($row = $result->fetch_assoc())
{
    if (!$first) { 
    	$json .=  ','; 
    } 
    else { 
    	$first = false; 
    }
    $json .= '{"value":"'.$row['nimi'].'"}';
}
$json .= ']';
*/

//$json ='[{"value":"Marten Hennoch"},{"value":"Martin Neeger"}]';

$json = "";
$first = true;
while($row = mysql_fetch_array($result)){
    if (!$first) { 
	    $json .=  ','; 
    } 
    else { 
    	$first = false; 
    }
    $json .= '"'.$row['nimi'].'"';
}
//$json .= "'";
echo $json

?>